var xmlhttp = null;

if(xmlhttp==null){
	xmlhttp=new XMLHttpRequest();
}

if(xmlhttp==null){
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
}

function load20Tweets(){
	this.proxy = "/ajaxgw/AjaxGateway?url=";
	this.url = this.proxy + "http://friendfeed-api.com/v2/feed/0m4r";
	xmlhttp=null;
	if (window.XMLHttpRequest){// code for all new browsers
		xmlhttp=new XMLHttpRequest();
	}else if (window.ActiveXObject){// code for IE5 and IE6
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}

	if (xmlhttp!=null){
		xmlhttp.onreadystatechange=state_Change;
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
	}else  {
		alert("Your browser does not support XMLHTTP.");
	}
}

function state_Change(){
	if (xmlhttp.readyState==4)  {// 4 = "loaded"
		if (xmlhttp.status==200)    {// 200 = OK
			var json = eval('(' + xmlhttp.responseText + ')');
			var tweetes = json.entries.length;
			for(var k=0; k<tweetes; k++){
				var id = json.entries[k].id;
				var text = json.entries[k].body;
				$('debug1').insert("<p>" + id + " - " + text + "</p>");
			}
		}else{
			$('debug1').insert("xmlhttp.status: " + xmlhttp.status);	
		}
	}
}  